package com.example.common;


import cn.hutool.core.date.DateUtil;
import cn.hutool.core.util.RandomUtil;

import java.util.Locale;

public interface Constants {
    String REGISTER_PHONE_TEMPTLATECODE="SMS_472760193";//手机注册模版CODE
    String RESET_PASSORD_PHONE_TEMPTLATECODE="SMS_472815184";//手机重置密码模版CODE
    String EMAIL_CODE_KEY="email:code:";//邮箱验证码key
    String PHONE_CODE_KEY="phone:code:";//手机验证码key
    String NO_INFORMATION = "暂无数据，请稍后搜索";
    String TOKEN = "token";
    String LOGGED_OUT = "不存在";
    String USER_DEFAULT_PASSWORD = "123";
    Long VALIDITY_CODE_TIME=60*5L;//验证码有效时长
    Long EFFECTIVE_TIME = 60 * 30L;//缓存数据有效时常
    Long NULL_STR_TIME=60L;
    Long LIMIT_IP_TIME = 2L;//2秒内访问超过100次
    Long MAX_IP_THRESHOLD_PER_MINUTE = 1000L; // ip访问阈值(封)
    Long MAX_REQUESTS_PER_MINUTE = 100L; // 每10s最大请求数

    //对于热点数据进行随机时常缓长存
    Long RANDOM_TIME = RandomUtil.randomLong(60L, 180L);

    String ALL_TYPE_LIST_KEY = "allType";
    String ALL_TIKU_LIST_KEY = "allTiku";
    String ALL_QUESTION_LIST_KEY = "allQuestion";
    String ARTICEL_TYPE = "articelType";
    String QUESTION_TYPE = "questionType";


    String QUESTION_KEY = "question:";
    String ARTICEL_KEY = "articel:";
    String ALL_QUESTION_NAME_LIST_KEY = "allQuestionName";
    String DEFAULT_NAME = "默认昵称";
    String CANCEL_USER = "已注销";
    String RESET_PASSWORD = "123456";//用户重置密码

    String NULL_STR = "";
    String CREATE_TIME = DateUtil.now();
    String UPDATE_TIME = DateUtil.now();

    Integer STATUS_YES = 1;//收藏
    Integer STATUS_NO = 0;//未收藏
    Integer DEFAULT_STATUS = 2;
    String MAPPING_TAMPLAFT = "{\n" +
            "  \"mappings\": {\n" +
            "    \"properties\": {\n" +
            "      \"id\":{\n" +
            "        \"type\": \"keyword\"\n" +
            "      },\n" +
            "      \"question_name\":{\n" +
            "        \"type\": \"text\",\n" +
            "        \"analyzer\": \"ik_smart\"\n" +
            "      },\n" +
            "      \"answer\":{\n" +
            "        \"type\": \"text\",\n" +
            "        \"analyzer\": \"ik_smart\"\n" +
            "      },\n" +
            "      \"count\":{\n" +
            "        \"type\": \"long\"\n" +
            "      },\n" +
            "      \"img\":{\n" +
            "        \"type\": \"keyword\",\n" +
            "        \"index\": false\n" +
            "      }\n" +
            "    }\n" +
            "  }\n" +
            "}";
    /**
     * UTF-8 字符集
     */
    public static final String UTF8 = "UTF-8";

    /**
     * GBK 字符集
     */
    public static final String GBK = "GBK";

    /**
     * 系统语言
     */
    public static final Locale DEFAULT_LOCALE = Locale.SIMPLIFIED_CHINESE;

    /**
     * www主域
     */
    public static final String WWW = "www.";

    /**
     * http请求
     */
    public static final String HTTP = "http://";

    /**
     * https请求
     */
    public static final String HTTPS = "https://";

    /**
     * 通用成功标识
     */
    public static final String SUCCESS = "0";

    /**
     * 通用失败标识
     */
    public static final String FAIL = "1";

    /**
     * 登录成功
     */
    public static final String LOGIN_SUCCESS = "Success";

    /**
     * 注销
     */
    public static final String LOGOUT = "Logout";

    /**
     * 注册
     */
    public static final String REGISTER = "Register";

    /**
     * 登录失败
     */
    public static final String LOGIN_FAIL = "Error";

    /**
     * 所有权限标识
     */
    public static final String ALL_PERMISSION = "*:*:*";

    /**
     * 管理员角色权限标识
     */
    public static final String SUPER_ADMIN = "admin";

    /**
     * 角色权限分隔符
     */
    public static final String ROLE_DELIMETER = ",";

    /**
     * 权限标识分隔符
     */
    public static final String PERMISSION_DELIMETER = ",";

    /**
     * 验证码有效期（分钟）
     */
    public static final Integer CAPTCHA_EXPIRATION = 2;

    /**
     * 令牌
     */


    /**
     * 令牌前缀
     */
    public static final String TOKEN_PREFIX = "Bearer ";

    /**
     * 令牌前缀
     */
    public static final String LOGIN_USER_KEY = "login_user_key";

    /**
     * 用户ID
     */
    public static final String JWT_USERID = "userid";


    /**
     * 用户头像
     */
    public static final String JWT_AVATAR = "avatar";

    /**
     * 创建时间
     */
    public static final String JWT_CREATED = "created";

    /**
     * 用户权限
     */
    public static final String JWT_AUTHORITIES = "authorities";

    /**
     * 资源映射路径 前缀
     */
    public static final String RESOURCE_PREFIX = "/profile";

    /**
     * RMI 远程方法调用
     */
    public static final String LOOKUP_RMI = "rmi:";

    /**
     * LDAP 远程方法调用
     */
    public static final String LOOKUP_LDAP = "ldap:";

    /**
     * LDAPS 远程方法调用
     */
    public static final String LOOKUP_LDAPS = "ldaps:";

    /**
     * 自动识别json对象白名单配置（仅允许解析的包名，范围越小越安全）
     */
    public static final String[] JSON_WHITELIST_STR = {"org.springframework", "com.ruoyi"};

    /**
     * 定时任务白名单配置（仅允许访问的包名，如其他需要可以自行添加）
     */
    public static final String[] JOB_WHITELIST_STR = {"com.ruoyi.quartz.task"};

    /**
     * 定时任务违规的字符
     */
    public static final String[] JOB_ERROR_STR = {"java.net.URL", "javax.naming.InitialContext", "org.yaml.snakeyaml",
            "org.springframework", "org.apache", "com.ruoyi.common.utils.file", "com.ruoyi.common.config", "com.ruoyi.generator"};


}
